package com.itheima.core;

import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
public class PageInfo implements Serializable {
    private List<?> list;
    private Integer pageNum;
    private Integer pageSize;
    private Integer total;
    private Integer totalPage;

    /**
     *计算总页数
     * @param total 总记录数
     * @param pageSize 每页显示条数
     * @return
     */
    public static Integer totalPage(Integer pageSize, Integer total){
        int totalPage = total % pageSize == 0 ? total/pageSize : total/pageSize + 1;

        return totalPage;
    }
}
